<?php
/**
* @author Tibor Pino (tibor.pino@gmail.com)
* @license released under GNU Public License v. 2
* @copyright Copyright (c) 2007, Tibor Pino
*
*/

class ArticleMenuHelper extends AppHelper
{
	public $helpers = array('Html','Form');
	
	public function create($type = "ArticleAddForm") {
		$content = "<button onclick=\"new Ajax.Updater('preview', '".$this->Html->url(array('controller'=>'articles','action'=>'preview'))."',  {asynchronous:true, evalScripts:true, parameters:Form.serialize('".$type."'),onLoading:function(request){Element.show('article_loading')} ,onComplete:function(request){Element.hide('article_loading');Element.show('preview')}}); return false;\">".__('preview',true)."</button>";
		$content .= $this->Form->submit(__("publish",true),array('div'=>false));
		$content .= '<span id="article_loading" style="display: none;">'.$this->Html->image("spinner.gif",array('alt'=>"Spinner")).'</span>';
		return $this -> output($content);
	}
}
?>